<template>
  <div @click="toTop" class="totop">
    <van-icon name="back-top" />
  </div>
</template>

<script>
export default {
  methods:{
    toTop(){
      document.documentElement.scrollTop = 0
      document.body.scrollTop = 0
    }
  }
}
</script>

<style>
.van-icon-back-top{
  vertical-align: middle;
}
.totop .van-icon{
  display: inline-block;
}
.totop{
  position: fixed;
  right: 20PX;
  bottom: 65PX;
  width: 40PX;
  line-height: 40PX;
  border-radius: 40PX;
  z-index: 4999;
  background: rgba(0,0,0,.5);
  color: #fff;
  font-size: 26PX;
  text-align: center;
}
</style>